package com.gxy.learn.design.model.construction.flyweight;

import lombok.extern.slf4j.Slf4j;

/**
 * @description: 享元模式测试
 * @author: gaoxueyong
 * @Date: 2022/11/8 10:35
 */
@Slf4j
public class Client {
    public static void main(String[] args) {
        AbstractBox box1 = BoxFactory.getInstance().getShape("I");
        box1.display("红色");

        AbstractBox box2 = BoxFactory.getInstance().getShape("L");
        box2.display("黄色");

        AbstractBox box3 = BoxFactory.getInstance().getShape("O");
        box3.display("黑色");

        AbstractBox box4 = BoxFactory.getInstance().getShape("O");
        box4.display("灰色");
        log.info("灰色和黑色是否同一个对象：{}",box3 == box4);
    }
}
